package com.ld.security.gateway.feign;

import lombok.Data;

/**
 * 包装容器类
 * @param <E>
 */
@Data
public class DataVo<E>  {


    private E data;


    private int code = 200;


    private String message = "操作成功";

    public DataVo() {

    }

    public DataVo(E data) {
        this.data = data;
    }

    public static <E>  DataVo<E> of(E data){
        return new DataVo(data);
    }
    public static <E>  DataVo<E> of(){
        return new DataVo();
    }

    public void throwEx(){
        if(code != 200){
            throw new RuntimeException(this.message);
        }
    }
}
